<template>
  <div class="search">
    <f-form ref="form" :action="api.receive" :form-key="this.formItem.msgUserId" >
      <f-form-item label="消息ID"  name="msgId"    :value="formItem.msgId" />
      <f-form-item label="接收人"  name="receiveUserId"    :value="formItem.receiveUserId" />
      <f-form-item label="读取状态"  name="readState" dataType="number"   :value="formItem.readState" />
      <f-form-item label="删除状态"  name="delState" dataType="number"   :value="formItem.delState" />
      <f-form-item label="创建时间"  name="createTime"    :value="formItem.createTime" />
      <f-form-item label="更新时间"  name="updateTime"    :value="formItem.updateTime" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'receiveForm',
    props: {},
    data() {
      return {
        api:api,
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          msgUserId: '',
          msgId: '',
          receiveUserId: '',
          readState: '',
          delState: '',
          createTime: '',
          updateTime: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.msgUserId) {
          this.formItem = data
          this.isAdd = false
          this.loaded = true
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
